/*
  Nokia LCD Demo - A demo using the NokiaLCD library for a Nokia LCD with the epson driver.
  Created by Thomas Jespersen, July 2009 (Originally Arduino Sketch by Gravitech.us)
  Released into the public domain.
*/

#include <NokiaLCD.h>

// Nokia LCD Setup settings
#define RED			0xE0
#define GREEN			0x1C
#define BLUE			0x03
#define YELLOW			0xFC
#define MAGENTA			0xE3
#define CYAN			0x1F
#define BLACK			0x00
#define WHITE			0xFF
#include "WProgram.h"
void setup();
void loop();
NokiaLCD nokiaLcd;


void setup() 
{ 
  DDRD |= B01111100;   // Set SPI pins as output 
  PORTD |= B01111100;  // Set SPI pins HIGH
  
  nokiaLcd.lcd_init();
  delay(500);
} 
 
void loop() 
{
 char text [50];

 nokiaLcd.draw_color_bar();
 
 delay(2000);
 nokiaLcd.lcd_clear(BLACK,0,0,131,131);
   
 strcpy(text," LCD6610");
 nokiaLcd.lcd_draw_text(YELLOW, BLACK, 35, 5, text);
 strcpy(text," 132X132");
 nokiaLcd.lcd_draw_text(CYAN, BLACK, 35, 15, text);
 strcpy(text," Color Graphic LCD");
 nokiaLcd.lcd_draw_text(CYAN, BLACK, 3, 23, text);
 strcpy(text,"WWW.GRAVITECH.US");
 nokiaLcd.lcd_draw_text(RED, WHITE, 12, 33, text);
 strcpy(text," TEST GREEN COLOR ");
 nokiaLcd.lcd_draw_text(GREEN, BLACK, 7, 45, text);
 strcpy(text," TEST BLUE COLOR ");
 nokiaLcd.lcd_draw_text(BLUE, BLACK, 7, 60, text);
 strcpy(text," TEST WHITE COLOR ");
 nokiaLcd.lcd_draw_text(WHITE, BLACK, 7, 75, text);
 strcpy(text," TEST MAGENTA COLOR ");
 nokiaLcd.lcd_draw_text(MAGENTA, BLACK, 7, 90, text);
 strcpy(text," TEST CYAN COLOR ");
 nokiaLcd.lcd_draw_text(CYAN, BLACK, 7, 105, text);
 strcpy(text," TEST YELLOW COLOR ");
 nokiaLcd.lcd_draw_text(YELLOW, BLACK, 7, 120, text);
 
 delay(2000);
 nokiaLcd.lcd_clear(BLACK,0,0,131,131);
} 


int main(void)
{
	init();

	setup();
    
	for (;;)
		loop();
        
	return 0;
}

